﻿using System;
using Dexter.CallContext;
using Dexter.Logger.Contracts;

namespace Dexter.Services.Implementation {
	public class UserUrlBuilder : UrlBuilderBase, IUserUrlBuilder {
		/// <summary>
		/// Initializes a new instance of the <see cref="UserUrlBuilder"/> class.
		/// </summary>
		/// <param name="logger">The logger.</param>
		/// <param name="dexterContext">The dexter context.</param>
		/// <param name="configurationService">The configuration service.</param>
		public UserUrlBuilder ( ILogger logger , IDexterContext dexterContext , IConfigurationService configurationService ) : base ( logger , dexterContext , configurationService ) {}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Account/CreateUser/
		/// </example>
		public string NewUser {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Account/CreateUser/" ) );
			}
		}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Account/ConfirmDelete/Username/
		/// </example>
		public string DeleteUser ( string username ) {
			return ToCaseConfiguration ( new Uri ( HomePage, string.Format ( "Admin/Account/ConfirmDelete/{0}/", username ) ) );
		}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Account/ChangePassword/Username/
		/// </example>
		public string ChangeUserPassword ( string username ) {
			return ToCaseConfiguration ( new Uri ( HomePage, string.Format ( "Admin/Account/ChangePassword/{0}/", username ) ) );
		}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Account/ChangePermissions/Username/
		/// </example>
		public string ChangePermissions ( string username ) {
			return ToCaseConfiguration ( new Uri ( HomePage, string.Format ( "Admin/Account/ChangePermissions/{0}/", username ) ) );
		}
	}
}
